import { useModel } from "umi";

import AddHomepageCommodity from "../components/homepage/commodity/Add";
import AddHomepageNotice from "../components/homepage/notice/Add";
import EditHomepageNotice from "../components/homepage/notice/Edit";
import AddHomepagePackage from "../components/homepage/package/Add";
import AddHomepageService from "../components/homepage/service/Add";
import AddHomepageRotation from "../components/homepage/rotation/Add";


const useHelperHomepage = () => {
    const { setModalVisible, setModalTitle, setModalWidth, setModalComponent, setModalStyle } = useModel("global.modal");


    const openAddHomepageCommodityModal = () => {
        setModalTitle("添加首页商品");
        setModalVisible(true);
        setModalWidth(800);
        setModalComponent(<AddHomepageCommodity reloadData={console.log(11)} commodities={[]} />);
    };

    const openAddHomepageNoticeModal = () => {
        setModalTitle("添加首页通知");
        setModalVisible(true);
        setModalWidth(800);
        setModalComponent(<AddHomepageNotice reloadData={console.log(11)} commodities={[]} />);
    };

    const openEditHomepageNoticeModal = () => {
        setModalTitle("编辑通知");
        setModalVisible(true);
        setModalWidth(800);
        setModalComponent(<EditHomepageNotice reloadData={console.log(11)} commodities={[]} />);
    };

    const openAddHomepagePackageModal = () => {
        setModalTitle("添加首页套餐");
        setModalVisible(true);
        setModalWidth(800);
        setModalComponent(<AddHomepagePackage reloadData={console.log(11)} commodities={[]} />);
    };

    const openAddHomepageServiceModal = () => {
        setModalTitle("添加首页服务");
        setModalVisible(true);
        setModalWidth(800);
        setModalComponent(<AddHomepageService reloadData={console.log(11)} commodities={[]} />);
    };

    const openAddHomepageRotationModal = () => {
        setModalTitle("添加首页轮播");
        setModalVisible(true);
        setModalWidth(800);
        setModalComponent(<AddHomepageRotation reloadData={console.log(11)} commodities={[]} />);
    };


    return { openAddHomepageCommodityModal, openAddHomepageNoticeModal, openEditHomepageNoticeModal, openAddHomepagePackageModal, openAddHomepageServiceModal, openAddHomepageRotationModal };
};

export default useHelperHomepage;
